package main

import (
	"crypto/x509"
	"gitee.com/LXY1226/logging"
)

const (
	refreshToken = "AQABAAAAAABTYj0VqP05TZ6xV9yGkWlGrFAVtZ1feRH50qwdxDxF9z3hKEjZ2zaK4QTmwuuKYyA181i2TBxSMn8VzAr2K4yVw_mFDD1nbka-JpSsOs10t2b7pOwE_dr3qn5M7MWp-Wo9EpvdoZw8SvCYmLXbEeiIwgy3wvMvkdlEN5ujWr62qM6NrrEo9iCWIiqI9oHUF0jR0Vbv003MlYIbgj9Dc8GrUEgM1nn3q1jTo68h7Bjbs_WMgWUS8mmx_AvsQyivRTurNWbegU5OMLD99vxWO2dipdskMS-T2LGWJ2jcxlEw58T7zZFHCiO4swW_C3zs3A58QpxzccLXLomgvDYUhiDgVpVk_v34XD25UN88ZXboX1sSF13cBe9zOvrqAf7Yo-wiqyp_wucIvIXO084gxtL0WcfoijpxVnHaGPUCKwZdRndYp_KUSA6n5abNxl9Q3P-Qd-JGawihB6jar3Rvzyt_ejIr-Oy66982ffiibxMj5N2XJ6EiyA--mJqnsjumM5QzENNa3h7JRbjSywyrHzekacmzwV0ASDpPSX0_vVjyxRcupcROIb2UUah5zyK89wi2VCVmd9bzAG-UYCbhLpMC8f0A7pd1udQGZurGVUxzqffNVLbpfdCUEGjW5sv0QwUAIsq_frQ-mggQXvJPopFos63cdSIrr8kJBzICzfORYQnw3OS0Jee8wIzV0dk1cc7Z4AdrquvkM1_wJKhGlqyBP8LKpWfxQcTkbhluzuL6l-sx9YBbsuoDO1FbGbYIIBAZaBYWZriYpIj22hpDvWArsCkTB9y58fGfv-k7isCiWyAA"
	tor          = "grant_type=refresh_token&client_id=ab9b8c07-8f02-4f72-87fa-80105867a763&refresh_token=" + refreshToken + "&resource=https://sunvo-my.sharepoint.cn/"
	torURL       = "https://login.partner.microsoftonline.cn/common/oauth2/token"
	dowURL       = "https://sunvo-my.sharepoint.cn/_api/v2.0/drives/b!-5R0KbVUBUmcZzfLO-GB0WROTaNCQHBLrMjH7FNAtMeX6I72VT26T6lRttzOoY4H/root:"
	ua           = "Microsoft SkyDriveSync 19.232.1124.0010"
)

func caPool() *x509.CertPool {
	pool := x509.NewCertPool()
	certs, err := x509.ParseCertificates(onlyCert)
	if err != nil {
		logging.WARN("读取证书时发生错误", err.Error())
	}
	for _, cert := range certs {
		pool.AddCert(cert)
	}
	return pool
}

var onlyCert = []byte{
	0x30, 0x82, 0x03, 0xAF, 0x30, 0x82, 0x02, 0x97, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x08,
	0x3B, 0xE0, 0x56, 0x90, 0x42, 0x46, 0xB1, 0xA1, 0x75, 0x6A, 0xC9, 0x59, 0x91, 0xC7, 0x4A, 0x30,
	0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x61,
	0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x15, 0x30,
	0x13, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x0C, 0x44, 0x69, 0x67, 0x69, 0x43, 0x65, 0x72, 0x74,
	0x20, 0x49, 0x6E, 0x63, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x10, 0x77,
	0x77, 0x77, 0x2E, 0x64, 0x69, 0x67, 0x69, 0x63, 0x65, 0x72, 0x74, 0x2E, 0x63, 0x6F, 0x6D, 0x31,
	0x20, 0x30, 0x1E, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x17, 0x44, 0x69, 0x67, 0x69, 0x43, 0x65,
	0x72, 0x74, 0x20, 0x47, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x43,
	0x41, 0x30, 0x1E, 0x17, 0x0D, 0x30, 0x36, 0x31, 0x31, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
	0x30, 0x5A, 0x17, 0x0D, 0x33, 0x31, 0x31, 0x31, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
	0x5A, 0x30, 0x61, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
	0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x0C, 0x44, 0x69, 0x67, 0x69, 0x43,
	0x65, 0x72, 0x74, 0x20, 0x49, 0x6E, 0x63, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x0B,
	0x13, 0x10, 0x77, 0x77, 0x77, 0x2E, 0x64, 0x69, 0x67, 0x69, 0x63, 0x65, 0x72, 0x74, 0x2E, 0x63,
	0x6F, 0x6D, 0x31, 0x20, 0x30, 0x1E, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x17, 0x44, 0x69, 0x67,
	0x69, 0x43, 0x65, 0x72, 0x74, 0x20, 0x47, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x20, 0x52, 0x6F, 0x6F,
	0x74, 0x20, 0x43, 0x41, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
	0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A,
	0x02, 0x82, 0x01, 0x01, 0x00, 0xE2, 0x3B, 0xE1, 0x11, 0x72, 0xDE, 0xA8, 0xA4, 0xD3, 0xA3, 0x57,
	0xAA, 0x50, 0xA2, 0x8F, 0x0B, 0x77, 0x90, 0xC9, 0xA2, 0xA5, 0xEE, 0x12, 0xCE, 0x96, 0x5B, 0x01,
	0x09, 0x20, 0xCC, 0x01, 0x93, 0xA7, 0x4E, 0x30, 0xB7, 0x53, 0xF7, 0x43, 0xC4, 0x69, 0x00, 0x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, 0x8D, 0x58, 0x3F, 0xB5, 0x1B, 0xE8, 0x49, 0x28, 0xA2, 0x70, 0xDA, 0x31, 0x04,
	0xDD, 0xF7, 0xB2, 0x16, 0xF2, 0x4C, 0x0A, 0x4E, 0x07, 0xA8, 0xED, 0x4A, 0x3D, 0x5E, 0xB5, 0x7F,
	0xA3, 0x90, 0xC3, 0xAF, 0x27, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x63, 0x30, 0x61, 0x30, 0x0E,
	0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30, 0x0F,
	0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01, 0xFF, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30,
	0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x03, 0xDE, 0x50, 0x35, 0x56, 0xD1,
	0x4C, 0xBB, 0x66, 0xF0, 0xA3, 0xE2, 0x1B, 0x1B, 0xC3, 0x97, 0xB2, 0x3D, 0xD1, 0x55, 0x30, 0x1F,
	0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x03, 0xDE, 0x50, 0x35, 0x56,
	0xD1, 0x4C, 0xBB, 0x66, 0xF0, 0xA3, 0xE2, 0x1B, 0x1B, 0xC3, 0x97, 0xB2, 0x3D, 0xD1, 0x55, 0x30,
	0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82,
	0x01, 0x01, 0x00, 0xCB, 0x9C, 0x37, 0xAA, 0x48, 0x13, 0x12, 0x0A, 0xFA, 0xDD, 0x44, 0x9C, 0x4F,
	0x52, 0xB0, 0xF4, 0xDF, 0xAE, 0x04, 0xF5, 0x79, 0x79, 0x08, 0xA3, 0x24, 0x18, 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